import { isString } from "lodash"
import { OptionType } from "./types"

/**
 * 获取option值 
 * @param option 
 * @param fieldName 
 * @returns 
 */
export const getOptionRes = (
  option: OptionType | string,
  fieldName: keyof OptionType = 'value'
) => {
  if (isString(option)) {
    return option
  } else {
    return option?.[fieldName]
  }
}
